/*
 *    Copyright (c) 2018-2025, boss All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the boss developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: boss
 */

package com.hopes.bizz.emergency.resources.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hopes.bizz.emergency.common.constant.PlanDicConstant;
import com.hopes.bizz.emergency.common.constant.enums.ParkEmergencyModDictEnum;
import com.hopes.bizz.emergency.common.constant.enums.ParkEmergencySysDictEnum;
import com.hopes.boss.admin.api.resolver.DictResolver;
import com.hopes.boss.admin.api.resolver.enums.AdminDictEnum;
import com.hopes.boss.admin.api.resolver.enums.SysDictEnum;
import com.hopes.boss.common.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import com.hopes.boss.common.entity.BaseLogicEntity;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;

/**
 * 应急物资
 *
 * @author cx
 * @date 2023-11-01 15:22:45
 */
@Data
@TableName(value = "er_material")
@EqualsAndHashCode(callSuper = true)
@Schema(description = "应急物资")
public class ErMaterialEntity extends BaseLogicEntity {

    private static final long serialVersionUID = 1L;


	/**
	* 标识
	*/
    @TableId(type = IdType.ASSIGN_ID)
    @Schema(description="标识")
    private Long id;

	/**
	* 物资设备类别
	*/
    @Schema(description="物资设备类别")
    private Integer materialEquipmentType;

	/**
	* 物资设备名称
	*/
    @Schema(description="物资设备名称")
    private String materialEquipmentName;

	/**
	* 物资类型
	*/
    @Schema(description="物资类型")
    private Integer materialType;

	/**
	* 行政区域
	*/
    @Schema(description="行政区域")
    private String administrativeDivision;

	/**
	* 用途
	*/
    @Schema(description="用途")
    private String materialUse;

	/**
	* 物资设备编号
	*/
    @Schema(description="物资设备编号")
    private String materialEquipmentNo;

	/**
	* 规格型号
	*/
    @Schema(description="规格型号")
    private String specification;

	/**
	* 数量
	*/
    @Schema(description="数量")
    private Integer materialNum;

	/**
	* 存储单位
	*/
    @Schema(description="存储单位")
    private Integer storageUnit;

	/**
	* 单价
	*/
    @Schema(description="单价")
    private BigDecimal unitPrice;

	/**
	* 金额
	*/
    @Schema(description="金额")
    private BigDecimal materialMoney;

	/**
	* 资金来源
	*/
    @Schema(description="资金来源")
    private Integer sourceFunds;

	/**
	* 擅长处理事故
	*/
    @Schema(description="擅长处理事故")
    private Integer goodHandlingAccidents;

	/**
	* 监管层级
	*/
    @Schema(description="监管层级")
    private Integer superviseLevel;

	/**
	* 完好情况
	*/
    @Schema(description="完好情况")
    private String intactCondition;

	/**
	* 联系人姓名
	*/
    @Schema(description="联系人姓名")
    private String contactName;

	/**
	* 联系人电话
	*/
    @Schema(description="联系人电话")
    private String contactPhone;

	/**
	* 主要参数
	*/
    @Schema(description="主要参数")
    private String mainParameter;

	/**
	 * 是否使用
	 */
	@Schema(description="是否使用")
	private String useFlag;


	/**
	* 所属单元类别
	*/
    @Schema(description="所属单元类别")
    private Integer unitCategory;

	/**
	* 所属单元标识
	*/
    @Schema(description="所属单元标识")
    private Long unitId;

	/**
	* 所属单元名称
	*/
    @Schema(description="所属单元名称")
    private String unitName;

	/**
	* 单位名称
	*/
    @Schema(description="单位名称")
    private String companyName;

	/**
	* 所属仓库
	*/
    @Schema(description="所属仓库")
    private Long warehouseId;

	/**
	* 定位
	*/
    @Schema(description="定位")
    private String location;

	/**
	* 存储地址
	*/
    @Schema(description="存储地址")
    private String storageAddress;

	/**
	* 存放地址(仓库编号)
	*/
    @Schema(description="存放地址(仓库编号)")
    private String warehouseNumber;

	/**
	* 单位负责人姓名
	*/
    @Schema(description="单位负责人姓名")
    private String chargePersonName;

	/**
	* 单位负责人联系电话
	*/
    @Schema(description="单位负责人联系电话")
    private String chargePersonPhone;

	/**
	* 制造厂家
	*/
    @Schema(description="制造厂家")
    private String producer;

	/**
	* 购入日期
	*/
    @Schema(description="购入日期")
	@JsonFormat(pattern = "yyyy-MM-dd")
    private Date purchaseDate;

	/**
	* 生产日期
	*/
    @Schema(description="生产日期")
	@JsonFormat(pattern = "yyyy-MM-dd")
    private Date productDate;

	/**
	* 投入使用日期
	*/
    @Schema(description="投入使用日期")
	@JsonFormat(pattern = "yyyy-MM-dd")
    private Date useDate;

	/**
	* 到期日期
	*/
    @Schema(description="到期日期")
	@JsonFormat(pattern = "yyyy-MM-dd")
    private Date dueDate;

	/**
	* 物资提供商
	*/
    @Schema(description="物资提供商")
    private String materialSupplier;

	/**
	* 物资生产商
	*/
    @Schema(description="物资生产商")
    private String materialManufacturer;

	/**
	* 可回收
	*/
    @Schema(description="可回收")
    private Integer isRecyclable;

	/**
	* 状态
	*/
    @Schema(description="状态")
    private Integer satus;

	/**
	* 备注
	*/
    @Schema(description="备注")
    private String remarks;

	/**
	* 附件
	*/
    @Schema(description="附件")
    private String attachment;

	/**
	* 经度
	*/
    @Schema(description="经度")
    private String longitude;

	/**
	* 维度
	*/
    @Schema(description="维度")
    private String latitude;

	/**
	* 高度
	*/
    @Schema(description="高度")
    private String altitude;

	/**
	* 机构ID
	*/
    @Schema(description="机构ID")
    private Long orgId;

	/**
	 * 最新检查日期
	 */
	@Schema(description="最新检查日期")
	private LocalDate latestCheckDate;

	/**
	 * 下次检查日期
	 */
	@Schema(description="下次检查日期")
	private LocalDate nextCheckDate;


	public String getOrgIdStr() {
		return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company,this.orgId);
	}
	public String getMaterialEquipmentTypeStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_tree_material_type, this.getMaterialEquipmentType());
	}
	public String getMaterialTypeStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_tree_material_type, this.getMaterialType());
	}
	public String getSourceFundsStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_source_funds, this.getSourceFunds());
	}
	public String getSuperviseLevelStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_supervise_level, this.getSuperviseLevel());
	}
	public String getGoodHandlingAccidentsStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_good_handling_accidents, this.getGoodHandlingAccidents());
	}
	public String getUnitCategoryStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_unit_category, this.getUnitCategory());
	}
	public String getIsRecyclableStr(){
		return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.getIsRecyclable());
	}

	public String getStorageUnitStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_storage_unit, this.getStorageUnit());
	}

	public String getUnitIdStr(){
		if (this.getUnitCategory().equals(PlanDicConstant.UNIT_CATEGORY_WAREHOUSE)){
			return DictResolver.getItemLabelByValue(ParkEmergencyModDictEnum.emergency_warehouse_id, this.getUnitId());
		} else if (this.getUnitCategory().equals(PlanDicConstant.UNIT_CATEGORY_COMPANY)) {
			return DictResolver.getItemLabelByValue(AdminDictEnum.sys_company,this.getUnitId());
		} else if (this.getUnitCategory().equals(PlanDicConstant.UNIT_CATEGORY_TEAM)) {
			return DictResolver.getItemLabelByValue(ParkEmergencyModDictEnum.emergency_warehouse_id, this.getUnitId());
		}
		else {
			return  null;
		}
	}

	public String getSatusStr(){
		return DictResolver.getItemLabelByValue(ParkEmergencySysDictEnum.emergency_material_status, this.getSatus());
	}

	public String getUseFlagStr() {
		return DictResolver.getItemLabelByValue(SysDictEnum.yes_no_type, this.useFlag);
	}
}